﻿using System;
using System.Collections.Generic;
using System.Text;
using He.Common;
using System.Data;
using System.Data.SQLite;

namespace He.DAL
{
    public partial class logistics
    {
        public readonly string TblName = SysKeys.TABLE_PREFIX + "logistics";

        #region  Method
        /// <summary>
        /// 是否存在该订单号
        /// </summary>
        public bool ExistsOrderNumber(string orderNumber)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select count(1) from " + TblName);
            strSql.Append(" where order_number=@order_number");
            SQLiteParameter[] parameters = {
					new SQLiteParameter("@order_number", DbType.String)
			};
            parameters[0].Value = orderNumber;

            return DbHelperSQLite.Exists(strSql.ToString(), parameters);
        }

        /// <summary>
        /// 修改一列数据
        /// </summary>
        public void UpdateField(int id, string strValue)
        {
            DbHelperSQLite.UpdateField(TblName, id, strValue);
        }

        /// <summary>
        /// 获得前几行数据
        /// </summary>
        public DataSet GetList(int Top, string strWhere, string orderFiled)
        {
            return DbHelperSQLite.GetList(TblName, Top, "*", strWhere, orderFiled);
        }

        /// <summary>
        /// 获得查询分页数据
        /// </summary>
        public DataSet GetPageList(int pageSize, int currentPage, string strWhere, string orderFiled)
        {
            return DbHelperSQLite.GetPageList(TblName, pageSize, currentPage, "*", strWhere, orderFiled);
        }

        #endregion  Method
    }
}
